<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <button onclick="sendGet()">发送GET请求</button>
    <button onclick="sendPost()">发送POST请求</button>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script>
        function sendGet() {
            $.ajax({
                type: "get",
                url: "method",
                success: function (data, status) {
                    console.log(data);
                }
            })
        }

        function sendPost() {
            $.ajax({
            
                type: "post",
                url: "method",
                data: "request body",
                success: function (data, status) {
                    console.log(data);
                }
            })
        }
    </script>
</body>

</html>